The present invention relates generally to an improved data processing system and, in particular, to a process and system for improving execution performance in a runtime environment.
With the xe2x80x9cwrite once, run anywherexe2x80x9d concept, it is envisioned that applications or applets should be able to run on a mainframe computer and, without modification, also run on a hand-held device or Personal Digital Assistant (PDA). Obviously, a PDA and a mainframe computer have widely varying computing resources. An application running on these platforms may have widely varying amounts of memory or computing power at its disposal, and a properly designed application should take advantage of the available resources while maintaining its portability. On the other hand, since an application may execute in an environment with limited computing resources, a properly designed application should also attempt to save computing resources whenever possible while, again, maintaining its portability.
Many computer programs employ some type of graphical user interface (GUI) to provide output and receive input from a user. GUI routines are generally computationally expensive, and a program that makes a large number of calls to GUI routines may spend a significant amount of its execution time within these routines. Judicious use of calls to GUI routines is a standard programming practice for ensuring that computational resources are not wasted while an application is executing. However, an application must invoke the GUI routines in order to provide user interaction.
Many programming environments support a set of standard GUI components, such as buttons, checkboxes, text, labels, etc. In object-oriented programming environments, GUI components are often related in an inheritance hierarchy, e.g., the button class and the label class inherit from a generic component class. The class for a component inherits variables and methods from its superclass, including the paint method. The paint method is used to display the component and is called in response to an update or repaint request. For example, when a label that was previously covered by a window is uncovered when a user moves the window, any component that has been uncovered must redraw its contents, and this redrawing action is done in response to an update request or repaint request. In fact, any subclasses of the standard component classes are free to define their own paint methods (by overriding the paint method of the superclass) in order to provide additional graphics or a different look to the component. The paint methods of the subclasses are then called instead in response to an update or repaint request. Since components are used extensively in applications, their paint methods are called frequently, and a significant amount of execution time is spent within these routines.
Therefore, it would be advantageous to improve the performance of calls to GUI routines. It would be further advantageous to provide a process by which the handling of a paint event for a graphical user interface component may be optimized, thereby saving computing resources, and it would be particularly advantageous to provide an optimized process that is portable among computing platforms.
The present invention provides a process and system for blocking unnecessary callbacks to empty paint methods of graphical user interface components. The process initializes a platform-dependent peer class corresponding to a platform-independent class for the graphical user interface component and stores a value representing whether the platform-independent class extends a standard platform-independent class for the graphical user interface component. A native paint method determines whether a callback to a paint method of the platform-dependent peer object is necessary for processing of the paint event. The callback determination is performed by checking the stored value representing the extension of the standard graphics class for the component. If a callback is necessary, then the native paint method initiates a callback to the paint method of the platform-dependent peer object. The native paint method may be implemented in the C++ programming language, and the platform-dependent peer class and the platform-independent class may be implemented in the Java programming language.